package com.lmx.repoDomain.tmodel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

@JsonApiResource(type = "personlocation")
@Table(name = "tnb_person_location")
@Entity
public class PersonLocation extends BaseEntity {
	private String remark;// 备注

	private User lastUpdateUser;// 更新操作者userid

	private Integer createDateTime;// 创建时间

	private User createUser;

	private Integer lastUpdateDateTime;// 更新时间

	private Room room;

	private Customer customer;

	private Employee employee;

	private Integer locationTime;// 创建时间

	private Double amapLng;// 高德经度

	private Double amapLat;// 高德纬度

	private Double roomLng;// 室内经度/y

	private Double roomLat;// 室内纬度/x

	private User positingUser;// 定位的用户

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "employee_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@Column(name = "location_time")
	public Integer getLocationTime() {
		return locationTime;
	}

	public void setLocationTime(Integer locationTime) {
		this.locationTime = locationTime;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "room_id", foreignKey = @ForeignKey(name = "null"))
	public Room getRoom() {
		return room;
	}

	public void setRoom(Room room) {
		this.room = room;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "amap_lng")
	public Double getAmapLng() {
		return amapLng;
	}

	public void setAmapLng(Double amapLng) {
		this.amapLng = amapLng;
	}

	@Column(name = "amap_lat")
	public Double getAmapLat() {
		return amapLat;
	}

	public void setAmapLat(Double amapLat) {
		this.amapLat = amapLat;
	}

	@Column(name = "room_lng")
	public Double getRoomLng() {
		return roomLng;
	}

	public void setRoomLng(Double roomLng) {
		this.roomLng = roomLng;
	}

	@Column(name = "room_lab")
	public Double getRoomLat() {
		return roomLat;
	}

	public void setRoomLat(Double roomLat) {
		this.roomLat = roomLat;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "positing_user_id", foreignKey = @ForeignKey(name = "null"))
	public User getPositingUser() {
		return positingUser;
	}

	public void setPositingUser(User positingUser) {
		this.positingUser = positingUser;
	}
}
